﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;

namespace AbpBuild.EntityFrameworkCore
{
    public static class SampleDbConnectionStringManager
    {
        static System.Collections.Concurrent.ConcurrentDictionary<int, string> _dict;

        static SampleDbConnectionStringManager()
        {
            _dict = new ConcurrentDictionary<int, string>();
        }
        public static void AddOrUpdate(int key, string connectionString)
        {
            _dict.AddOrUpdate(key, connectionString, (k, v) => connectionString);
        }

        public static string Get(int key)
        {
            if (_dict.TryGetValue(key, out var val))
            {
                return val;
            }

            return null;
        }
    }

}
